/**
 * Copyright (c) Software Institude of PKU
 * All rights reserved. 
 * This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 */
package edu.pku.sei.modeler.model.uml.StructuredActivities;
// imports:
import org.w3c.dom.Element;

import edu.pku.sei.gefcommon.descriptor.annotation.MethodProperty;
import edu.pku.sei.modeler.model.common.*;
import edu.pku.sei.modeler.model.core.*;
import edu.pku.sei.modeler.model.xml.XMLUtility;

import edu.pku.sei.modeler.model.uml.BasicActions.OutputPin;
import edu.pku.sei.modeler.uml.modelHelper.ModelPackage;


/**
 * @generated
 *
 */
public class ConditionalNode extends StructuredActivityNode implements IConditionalNode {
	// attributes
	
	protected boolean isDeteminate;
	
	protected boolean isAssured;
	
	
	
	
	// references
	
	protected MetaTypedList clause;
	
	protected MetaTypedList result;
	
	
	
	// getters & setters for attributes
	
	@MethodProperty(
			id = "CONDITIONALNODE_ISDETEMINATE",
			catalog = "Model",
			name = ModelPackage.CONDITIONALNODE_ISDETEMINATE,
			setter = "setisDeteminate"
			)
	
	public boolean getIsDeteminate() {
		return isDeteminate;
	}
	public void setIsDeteminate(boolean newIsDeteminate) {
		boolean oldisDeteminate = isDeteminate;
		isDeteminate = newIsDeteminate;
		firePropertyChange(ModelPackage.CONDITIONALNODE_ISDETEMINATE, oldisDeteminate, newIsDeteminate);
	}
	
	@MethodProperty(
			id = "CONDITIONALNODE_ISASSURED",
			catalog = "Model",
			name = ModelPackage.CONDITIONALNODE_ISASSURED,
			setter = "setisAssured"
			)
	
	public boolean getIsAssured() {
		return isAssured;
	}
	public void setIsAssured(boolean newIsAssured) {
		boolean oldisAssured = isAssured;
		isAssured = newIsAssured;
		firePropertyChange(ModelPackage.CONDITIONALNODE_ISASSURED, oldisAssured, newIsAssured);
	}
	
	// getters for references
	
	public MetaTypedList getClause() {
		if(clause == null) {
			clause = new MetaTypedList(Clause.class, this, ModelPackage.CONDITIONALNODE_CLAUSE);
		}
		return clause;
	}
	
	public MetaTypedList getResult() {
		if(result == null) {
			result = new MetaTypedList(OutputPin.class, this, ModelPackage.CONDITIONALNODE_RESULT);
		}
		return result;
	}
	
	// save & load
	public void serialize(Element root) {
		super.serialize(root);
		// attributes
		
		XMLUtility.xmlInstance.serializeAttribute(root, ModelPackage.CONDITIONALNODE_ISDETEMINATE, isDeteminate);
		
		XMLUtility.xmlInstance.serializeAttribute(root, ModelPackage.CONDITIONALNODE_ISASSURED, isAssured);
		
		// references
		
		XMLUtility.xmlInstance.serializeNodesNotContain(root, ModelPackage.CONDITIONALNODE_CLAUSE, clause);		
		
		XMLUtility.xmlInstance.serializeNodesNotContain(root, ModelPackage.CONDITIONALNODE_RESULT, result);		
		
	}
	
	public void deSerialize(Element root) {
		super.deSerialize(root);
		// attributes
		
		isDeteminate = XMLUtility.xmlInstance.deSerializeBoolean(root, ModelPackage.CONDITIONALNODE_ISDETEMINATE);
		
		isAssured = XMLUtility.xmlInstance.deSerializeBoolean(root, ModelPackage.CONDITIONALNODE_ISASSURED);
		
		// references
		
		this.getClause().addAll(XMLUtility.xmlInstance.deSerializeNodesNotContain(root, ModelPackage.CONDITIONALNODE_CLAUSE, this));
		
		this.getResult().addAll(XMLUtility.xmlInstance.deSerializeNodesNotContain(root, ModelPackage.CONDITIONALNODE_RESULT, this));
		
	}
	
	public void dynamicSet(String featureID, Object value) {
		if(featureID == null || "".equals(featureID)) {
			return;
		}
		// attributes
		
		// references
		
		else if(ModelPackage.CONDITIONALNODE_CLAUSE.equals(featureID)) {
			getClause().add(value);
		}
		
		else if(ModelPackage.CONDITIONALNODE_RESULT.equals(featureID)) {
			getResult().add(value);
		}
		
		else
			super.dynamicSet(featureID, value);
	}
}
 
 
 
 
 